import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

/**
 * 获取底部安全区距离
 * @type {number}
 */
export const GET_SAFEAREA_BOTTOM = "GET_SAFEAREA_BOTTOM";
export const SET_SAFEAREA_BOTTOM = "SET_SAFEAREA_BOTTOM";

export const GET_SHOW_AD = "GET_SHOW_AD";
export const SET_SHOW_AD = "SET_SHOW_AD";

const store = new Vuex.Store({
  state: {
    safeareabottom: 0,

    selectPickUpPoint: {}, //选择的自提点
	showAD: false,
    guideSTDPath: null,
    selectPickUpPoint: {}, //选择的自提点缓存
    selectPickUpInfo: {}, //选择的自提点预留信息
    ticketReserveInfo: {}, //门票下单缓存
    settlementGoods: [],
    selectAddress:{}

  },
  getters: {
    [GET_SAFEAREA_BOTTOM]: (state) => {
      return state.safeareabottom;
    },
	[GET_SHOW_AD]: (state) => {
	  return state.showAD;
	},
  },
  mutations: {
    [SET_SAFEAREA_BOTTOM](state, num) {
      state.safeareabottom = num;
    },
    SELECT_PICK_UP_POINT(state, point) {
      state.selectPickUpPoint = point;
    },

	[SET_SHOW_AD]: (state, flag) => {
	  state.showAD = flag;
	},

    SELECT_PICK_UP_INFO(state, point) {
      state.selectPickUpInfo = point;
    },
    //
    TICKET_RESERVE_INFO(state, ticketReserveInfo) {
      state.ticketReserveInfo = ticketReserveInfo;
    },
    SELECT_ADDRESS_INFO(state, selectAddress) {
      state.selectAddress = selectAddress;
    },
    setSettlementGoods(state, settlementGoods) {
      state.settlementGoods = settlementGoods;
    },
    set_guideSTDPath(state, path) {
      state.guideSTDPath = path;
    }
  },
});

export default store;
